package test.hack11;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JButton;

public class Image2Button extends JButton {
	private Image image;
	public Image2Button(Image image){
		this.image=image;
		Dimension size= new Dimension(image.getWidth(null),image.getHeight(null));
		setSize(size);
		setPreferredSize(size);
		setMaximumSize(size);
		setMinimumSize(size);
	}
	protected void paintComponent(Graphics g) {
		g.drawImage(image,0,0,null);
//		System.out.println("paint");
	}

}
